$(function() {
	$('.btn-selectall').click(function() {
		$('#asks-list').uiTable('selectAll');
	});

	$('.reply-ask').click(function() {
		var me = $(this), url = me.attr('href');
		parent.Desktop.openIframeDialog('回复留言', url, function(frame) {
			frame.saveReply(window);
		});
		return false;
	});
	
	$('.edit-ask').click(function() {
		var me = $(this), url = me.attr('href');
		parent.Desktop.openIframeDialog('编辑留言', url, function(frame) {
			frame.saveReply(window);
		});
		return false;
	});
	$('.menu-reset-cmt').click(function() {//reset
		var ids = $('#asks-list').uiTable('selected'), url = $(this).attr('href');
		if(ids.length == 0) {
			alert('请选择要还原的留言');
			return false;
		}
		window.location.href = url + '&aid=' + ids.join(',');
		return false;
	});
	$('.menu-del-cmt').click(function() {//delete
		var ids = $('#asks-list').uiTable('selected'), url = $(this).attr('href');
		if(ids.length == 0) {
			alert('请选择要删除的留言');
			return false;
		}
		if(confirm('你确定要删除所选的留言吗?')) {
			window.location.href = url + '&aid=' + ids.join(',');
		}
		return false;
	});
	$('.menu-new-cmt').click(function() {//no
		var ids = $('#asks-list').uiTable('selected'), url = $(this).attr('href');
		if(ids.length == 0) {
			alert('请选择要设为不是垃圾的留言');
			return false;
		}
		window.location.href = url + '&aid=' + ids.join(',');
		return false;
	});
	
	$('.menu-spam-cmt').click(function() {//no
		var ids = $('#asks-list').uiTable('selected'), url = $(this).attr('href');
		if(ids.length == 0) {
			alert('请选择要设为垃圾的留言');
			return false;
		}
		window.location.href = url + '&aid=' + ids.join(',');
		return false;
	});
	$('.menu-trash-cmt').click(function() {//no
		var ids = $('#asks-list').uiTable('selected'), url = $(this).attr('href');
		if(ids.length == 0) {
			alert('请选择要移到回收站的留言');
			return false;
		}
		window.location.href = url + '&aid=' + ids.join(',');
		return false;
	});
});